// pages/myself/interaction/interaction.js
const { getInteraction } = require("../../../utils/http/api")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    taskList: [{
      taskName: "分享海报",
      taskCycleType: 0,
      taskType: 3,
      status: 0,
      detailedDescription: "将绿色环保活动大会活动海报分享至微信好友，或朋友圈即可获得100积分"
    },{
      taskName: "每日签到",
      taskCycleType: 1,
      taskType: 0,
      status: 1,
      detailedDescription: "完成签到可获得100积分"
    }],
    offLineList: [{
      taskType: 4,
      taskName: "会场签到",
      detailedDescription: "完成会场签到可获得100积分"
    },{
      taskName: "扫码打卡",
      detailedDescription: "完成拍照打卡可获得100积分"
    },{
      taskName: "展商打卡",
      detailedDescription: "完成展商打卡可获得100积分"
    },{
      taskName: "抽奖",
      detailedDescription: "具体结果请于线下查看"
    }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },
  toIndex(){
    wx.switchTab({
      url: '/pages/index/index',
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    var _this = this
    _this.getInteraction()
  },
  toPointDetail(){
    wx.navigateTo({
      url: '/pages/myself/points/pointsDetail/pointDetail',
    })
  },
  /**
   * 获取任务奖励互动
   */
  getInteraction(){
    var _this = this
    getInteraction().then((res) => {
      if (res.rows.length > 0) {
        const onlineList = res.rows
        console.log("奖励互动", onlineList)
        _this.setData({
          onlineList : onlineList
        })
      
      }
    })
  },
  
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})